package com.example.aiyou.passwordmanage.base;

import android.app.Activity;
import java.util.ArrayList;
import java.util.List;

import pl.com.salsoft.sqlitestudioremote.SQLiteStudioService;

/**
 * Created by hello on 2017-09-07.
 */

public class ActivityManage {
    public static List< Activity > activities = new ArrayList< >();
    public static void addActivity( Activity activity) {
        activities.add( activity);
    }
    public static void removeActivity( Activity activity) {
        activities.remove( activity); }
    public static void finishAll() {
        SQLiteStudioService.instance().stop();
        for (Activity activity : activities) {
            if (! activity.isFinishing()) {
                activity.finish();
            }
        }
        android.os.Process.killProcess(android.os.Process.myPid());
        activities.clear();
    }
}
